list.of.packages <- c("haven", "foreign", "readstata13")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
#load libraries
library(haven)
library(foreign)
library(readstata13)
##################################################################################################
for (i in 93:121){
#wave 114 is missing
if (i==114) {
next
}
w <- as.character(i)
data <- read_sav(paste0("Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX/vox_spss/vox",w,".sav"))
intdate <- data$DATE
#some waves stored interview number differently
if (i==99 | i==100){
nr <- data$nummer
} else if (i==116){
nr <- data$NR
}
else {
nr <- data$nr
}
voxnr <- i
dataframe <- data.frame(intdate, nr, voxnr)
save.dta13(dataframe, paste0("Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX/vox_dta/workingfiles/intdate_vox",w,".dta"), convert.dates=T)
}
setwd("~/Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX")
list.of.packages <- c("haven", "foreign", "readstata13")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
#load libraries
library(haven)
library(foreign)
library(readstata13)
#set working directory
setwd("~/Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX")
##################################################################################################
for (i in 93:121){
#wave 114 is missing
if (i==114) {
next
}
w <- as.character(i)
data <- read_sav(paste0("vox_spss/vox",w,".sav"))
intdate <- data$DATE
#some waves stored interview number differently
if (i==99 | i==100){
nr <- data$nummer
} else if (i==116){
nr <- data$NR
}
else {
nr <- data$nr
}
voxnr <- i
dataframe <- data.frame(intdate, nr, voxnr)
save.dta13(dataframe, paste0("Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX/vox_dta/workingfiles/intdate_vox",w,".dta"), convert.dates=T)
}
list.of.packages <- c("haven", "foreign", "readstata13")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
#load libraries
library(haven)
library(foreign)
library(readstata13)
#set working directory
setwd("~/Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX")
##################################################################################################
for (i in 93:121){
#wave 114 is missing
if (i==114) {
next
}
w <- as.character(i)
data <- read_sav(paste0("vox_spss/vox",w,".sav"))
intdate <- data$DATE
#some waves stored interview number differently
if (i==99 | i==100){
nr <- data$nummer
} else if (i==116){
nr <- data$NR
}
else {
nr <- data$nr
}
voxnr <- i
dataframe <- data.frame(intdate, nr, voxnr)
save.dta13(dataframe, paste0("vox_dta/workingfiles/intdate_vox",w,".dta"), convert.dates=T)
}
#Extract date variable from SPSS file and later merge it to .dta - set
#install required packages if you do not already have them
list.of.packages <- c("haven", "foreign", "readstata13")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
#load libraries
library(haven)
library(foreign)
library(readstata13)
#set working directory
setwd("~/Dropbox/FlurinaSchneider_work_KOF/project_border_political_repercussions/shp_vox_data/VOX")
##################################################################################################
for (i in 93:121){
#wave 114 is missing
if (i==114) {
next
}
w <- as.character(i)
data <- read_sav(paste0("vox_spss/vox",w,".sav"))
intdate <- data$DATE
#some waves stored interview number differently
if (i==99 | i==100){
nr <- data$nummer
} else if (i==116){
nr <- data$NR
}
else {
nr <- data$nr
}
voxnr <- i
dataframe <- data.frame(intdate, nr, voxnr)
save.dta13(dataframe, paste0("vox_dta/workingfiles/intdate_vox",w,".dta"), convert.dates=T)
}
